package com.jz.community.modulemine.information.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jz.community.modulemine.R;
import com.jz.community.modulemine.information.bean.SpecialCouponBean;

import java.util.List;

public class SpecialCouponAdapter extends BaseQuickAdapter<SpecialCouponBean.EmbeddedBean.ContentBean, BaseViewHolder> {

    public SpecialCouponAdapter(int layoutResId, @Nullable List<SpecialCouponBean.EmbeddedBean.ContentBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SpecialCouponBean.EmbeddedBean.ContentBean item) {
        TextView tv_special_coupon_type = helper.getView(R.id.tv_special_coupon_type);
        if ("1".equals(item.getCouponType())) {
            tv_special_coupon_type.setText("现金券");
        } else if ("2".equals(item.getCouponType())) {
            tv_special_coupon_type.setText("折扣券");
        } else if ("3".equals(item.getCouponType())) {
            tv_special_coupon_type.setText("免单券");
        }
        TextView tv_special_coupon_amount = helper.getView(R.id.tv_special_coupon_amount);
        TextView tv_special_coupon_unit = helper.getView(R.id.tv_special_coupon_unit);
        if ("1".equals(item.getCouponType())) {
            tv_special_coupon_amount.setText(item.getCouponAmount());
            tv_special_coupon_unit.setText("元");
        }
        if ("2".equals(item.getCouponType())) {
            tv_special_coupon_amount.setText(item.getCouponDiscount());
            tv_special_coupon_unit.setText("折");
        }
    }
}
